<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		$path=ROOT_AT .'/oss/'.$_SESSION['uniacid'].'/images/jy_poster/jy_kaoshi/';
		$handle = scandir($path);
		foreach($handle as $val){
			//排除目录中的.和..
			if($val !="." && $val !=".."){
				//如果是文件直接删除
				unlink($path.$val);
			}
	   }
	   $like='oss/'.$_SESSION['uniacid'].'/images/jy_poster/jy_kaoshi/';
	   pdo_delete('core_attachment',array('attachment like'=>'%'.trim($like).'%','uniacid'=>$_SESSION['uniacid']));
	   exi('设置成功');
	}
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_kaoshi/index/'),
		array('title'=>'视频','icon'=>'icon-video','action'=>'jy_kaoshi/videolist/'),
		array('title'=>'参与的','icon'=>'icon-manageorder','action'=>'jy_kaoshi/order/'),
		array('title'=>'我的','icon'=>'icon-wo1','action'=>'jy_kaoshi/myhome/'),
	);
	$hdps =array(
		array('title'=>'首页','picurl'=>'../addons/jy_kaoshi/resource/images/hdp.jpg'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['hdps']=$return['item']['hdps']?$return['item']['hdps']:$hdps;
	$return['item']['baobg']=$return['item']['baobg']?:'../addons/jy_kaoshi/resource/images/bg.jpg';
	$return['item']['footernav']=$return['item']['footernav']?$return['item']['footernav']:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'string','title'=>'网站名称','name'=>'title'),
					array('type'=>'image','title'=>'网站logo','name'=>'logo'),
					array('type'=>'switch','title'=>'完善个人信息才能绑定答题卡？','name'=>'ischeck_set'),
					array('type'=>'string','title'=>'报告培训机构名称','name'=>'baocname'),
					array('type'=>'image','title'=>'报告背景设置','name'=>'baobg','help'=>'建议尺寸：650-1000'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
				'title'=>'幻灯片',
					'list'=>array(
						array(
							'type'=>'array',
							'name'=>'hdps',
							'add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								)
						)
					)
			),
			array(
				'title'=>'板块导航',
					'list'=>array(
									array('type'=>'array','name'=>'bankuai','add_tip'=>'添加一个板块导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),							
										array('type'=>'string','name'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
